package rawengine.util;

public class MathUtil {
	
	
	public static <E extends Comparable<E>> E clamp(E value, E min, E max) 
	{
	    if (value.compareTo(min) < 0) 
	    	{
	    		return min;
	    	}
	    else if(value.compareTo(max) > 0)
	    	{
	    		return max;
	    	}
	    else return value;
	}

}
